<template>
	<view class="animated fadeIn faster">
		<view class="bg-fff px-3">
			<view class="d-flex d-flex-between pt-3" v-for="item in list" :key="item.id" @click="keClick(item.id)">
				<image class="mr-2 rounded10" :src="item.activity_image" mode="aspectFill" style="width: 280rpx;height: 160rpx;"></image>
				<view class="d-flex-item d-flex d-flex-column py-1 d-flex-between">
					<view class="text-clamp-two">{{item.activity_name}}</view>
					<view class="d-flex d-flex-between d-flex-middle">
						<view class="font24 colorsuccess">已报名{{item.application_number}}人</view>
					</view>
				</view>
			</view>
		</view>
		<view class="load-more d-flex d-flex-center pt-5 bg-fff" v-if="loadingType <2 || list.length>0">
			<text>{{loadingType == 0 ? '上拉显示更多' : (loadingType == 1 ? '正在加载...' : '~ 已经没有更多数据了~')}}</text>
		</view>
		<view class="d-flex d-flex-center d-flex-middle" style="padding-top: 440rpx;" v-else>
			<view class="d-flex d-flex-center d-flex-column d-flex-middle">
				<image src="https://168809.oss-cn-hangzhou.aliyuncs.com/community/empty.png" mode="widthFix" style="width: 130rpx;"></image>
				<text class="colorgrayy font24 mt-1">暂无任何内容</text>
			</view>
		</view>
	</view>
</template>

<script>
	import { userApi } from '@/http/userApi.js'
	export default {
		data() {
			return {
				loadingType:2,
				page:1,
				list:[]
			}
		},
		onReady() {
			this.init()
		},
		methods: {
			async init(){
				let that = this
				that.loadingType = 1
				try{
					const userId = uni.getStorageSync('myId')
					const result = await userApi.inEnrollList(userId,that.page)
					if(result.data){
						that.list = that.list.concat(result.data)
					}
					if(result.data && result.data.length>9){
						that.loadingType = 0
					}else{
						that.loadingType = 2
					}
				}catch(e){
					that.loadingType = 2
				}
			},
			keClick(cid){
				uni.navigateTo({
					url:'/pages/detail/detail?cid='+cid
				})
			},
			
		}
	}
</script>

<style>

</style>
